<template>
	<Layout class="p-5 bg-white">
		<Form :label-width="130">
			<FormItem class="w-50" label="订单编号:">
				<label>{{orderId}}</label>
			</FormItem>
			<FormItem class="w-50" label="客户名称:">
				<label>{{order.clientName}}</label>
			</FormItem>
			<FormItem class="w-50" label="金额:">
				<label>{{util.parseMoney(order.amount / 100, 2)}}</label>
			</FormItem>
			<FormItem class="w-50" label="订单支付类型:" v-if="consume_record != null">
				<label v-if="consume_record.type == 'P'">支付</label>
				<label v-if="consume_record.type == 'C'">卡扣</label>
				<label v-if="consume_record.type == 'V'">券扣</label>
			</FormItem>
			<FormItem class="w-50" label="订单支付手段:" v-if="payment_record != null">
				<label v-if="payment_record[0].payType == 'WX'">微信支付</label>
				<label v-if="payment_record[0].payType == 'ALI'">支付宝</label>
				<label v-if="payment_record[0].payType == 'YUN'">云闪付</label>
			</FormItem>
			<FormItem class="w-50" label="支付平台支付编号:" v-if="payment_record != null">
				<label>{{payment_record[0].originalCode}}</label>
			</FormItem>
			<FormItem class="w-50" label="订单状态:">
				<label v-if="order.statu == 'ST'">已开始</label>
				<label v-if="order.statu == 'UNPAY'">未支付</label>
				<label v-if="order.statu == 'FIN'">已结束</label>
			</FormItem>
			<FormItem class="w-50" label="开始时间:">
				<label>{{order.st}}</label>
			</FormItem>
			<FormItem class="w-50" label="结束时间:">
				<label>{{order.et}}</label>
			</FormItem>
			<FormItem class="w-50" label="时长:">
				<label>{{order.timeLongs}}</label>
			</FormItem>
			<FormItem class="text-right">
				<Button @click="cancel" class="ml-2">取消</Button>
			</FormItem>
		</Form>
	</Layout>
</template>

<script>
	export default {
		data: function() {
			return {
				orderId:"", 
				order:{},
				payment_record:{},
				consume_record:[]
			};
		},
		methods: {
			cancel: function() {
				this.$tabs.close();
			},
			init: function() {
				this.searchInfo();
			},
			searchInfo(){
				this.http.get({
					url:"/order/info",
					param:{
						orderId:this.$data.orderId
					}
				}).then(response => {
					this.$data.order = response.order;
					this.$data.consume_record = response.consume_record;
					this.$data.payment_record = response.payment_record;
					
				})
			}
		},
		created: function () {
			this.$data.orderId = this.$route.params.orderId;
			this.init();
		},
	}
</script>

<style>
</style>

